﻿using System;
using System.Collections;
using System.Web;
using System.Web.SessionState;

namespace NWebMock
{
    public class HttpSessionStateWrapper : IHttpSessionState
    {
        #region Constructors

        public HttpSessionStateWrapper(HttpSessionState session)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }

            this.innerSession = session;
        }

        #endregion

        #region Fields

        private HttpSessionState innerSession = null;

        #endregion

        #region Properties

        public int CodePage { get { return this.innerSession.CodePage; } set { this.innerSession.CodePage = value; } }

        public HttpSessionState Contents { get { return this.innerSession; } }

        public HttpCookieMode CookieMode { get { return this.innerSession.CookieMode; } }

        public int Count { get { return this.innerSession.Count; } }

        public bool IsCookieless { get { return this.innerSession.IsCookieless; } }

        public bool IsNewSession { get { return this.innerSession.IsNewSession; } }

        public bool IsReadOnly { get { return this.innerSession.IsReadOnly; } }

        public bool IsSynchronized { get { return this.innerSession.IsSynchronized; } }

        public object this[int index] { get { return this.innerSession[index]; } set { this.innerSession[index] = value; } }

        public object this[string name] { get { return this.innerSession[name]; } set { this.innerSession[name] = value; } }

        public ICollection Keys { get { return this.innerSession.Keys; } }

        public int LCID { get { return this.innerSession.LCID; } set { this.innerSession.LCID = value; } }

        public SessionStateMode Mode { get { return this.innerSession.Mode; } }

        public string SessionID { get { return this.innerSession.SessionID; } }

        public HttpStaticObjectsCollection StaticObjects { get { return this.innerSession.StaticObjects; } }

        public object SyncRoot { get { return this.innerSession.SyncRoot; } }

        public int Timeout { get { return this.innerSession.Timeout; } set { this.innerSession.Timeout = value; } }

        #endregion

        #region Methods

        public void Abandon()
        {
            this.innerSession.Abandon();
        }

        public void Add(string name, object value)
        {
            this.innerSession.Add(name, value);
        }

        public void Clear()
        {
            this.innerSession.Clear();
        }

        public void CopyTo(Array array, int index)
        {
            this.innerSession.CopyTo(array, index);
        }

        public IEnumerator GetEnumerator()
        {
            return this.innerSession.GetEnumerator();
        }

        public void Remove(string name)
        {
            this.innerSession.Remove(name);
        }

        public void RemoveAll()
        {
            this.innerSession.RemoveAll();
        }

        public void RemoveAt(int index)
        {
            this.innerSession.RemoveAt(index);
        }

        #endregion
    }
}
